﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using Baddies.Map;
using Microsoft.Xna.Framework;

namespace BaddiesEditor.PaintTools
{
    /// <summary>
    /// Base class for the different painting tools of the editor.
    /// </summary>
    public class PaintTool
    {
        /// <summary>
        /// Position of the selected tile image in the editor.
        /// </summary>
        private Vector2 selectedTileImage;

        /// <summary>
        /// Position of the screen we clicked on.
        /// </summary>
        private Vector2 screenPosition;

        /// <summary>
        /// Cursor image for this tool.
        /// </summary>
        private Bitmap cursorIcon;

        /// <summary>
        /// Gets the position of the screen we clicked on.
        /// </summary>
        /// <value>The position of the screen we clicked on.</value>
        protected Vector2 ScreenPosition
        {
            get { return this.screenPosition; }
        }

        /// <summary>
        /// Gets the position of the selected tile image in the editor.
        /// </summary>
        /// <value>The Position of the selected tile image in the editor.</value>
        protected Vector2 SelectedTileImage
        {
            get { return this.selectedTileImage; }
        }

        /// <summary>
        /// Gets the image for the cursor asociated with this tool.
        /// </summary>
        /// <value>The image for the cursor asociated with this tool.</value>
        public Bitmap CursorIcon
        {
            get { return this.cursorIcon; }
        }

        /// <summary>
        /// Initializes a new instance of the PaintTool class.
        /// </summary>
        /// <param name="cursorIcon">Bitmap image for this tool.</param>
        public PaintTool(Bitmap cursorIcon)
        {
            this.cursorIcon = cursorIcon;
        }

        /// <summary>
        /// Initializes the data in the PaintTool.
        /// </summary>
        /// <param name="screenX">X position in the gameVierport.</param>
        /// <param name="screenY">Y position in the gameVierport.</param>
        /// <param name="tileX">X position in the tileSet.</param>
        /// <param name="tileY">Y position in the tileSet.</param>        
        public void Initialize(int screenX, int screenY, int tileX, int tileY)
        {
            this.selectedTileImage = new Vector2(tileX, tileY);
            this.screenPosition = new Vector2(screenX, screenY);            
        }

        /// <summary>
        /// Applies the tool changes to the map.
        /// </summary>
        /// <param name="map">MapGrid to apply the changes on.</param>
        /// <param name="tileSize">Size of a tile in pixels.</param>
        public virtual void Use(MapGrid map, int tileSize)
        { 
        }
    }
}
